package dnl.dev.memlog.parser;

import org.apache.commons.lang.StringUtils;


public class TypeAHistogramTokenizing implements HistogramTokenizingStrategy {

	@Override
	public HistogramLineInfo parse(String line) {
		String[] strings = StringUtils.split(line, "\t ");
		if(strings.length != 4){
			return null;
		}
		HistogramLineInfo histogramLineInfo = new HistogramLineInfo();
		histogramLineInfo.setClassName(strings[3]);
		histogramLineInfo.setNumOfInstances(Integer.parseInt(strings[1]));
		histogramLineInfo.setTotalSizeInBytes(Integer.parseInt(strings[2]));
		return histogramLineInfo;
	}

}
